package com.qfedu.edu.searchservice.controller;

import com.qfedu.edu.po.Class;
import com.qfedu.edu.result.R;
import com.qfedu.edu.searchservice.service.SearchService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @author xiaobobo
 * @title: SearchController
 * @projectName seckill-fy-2401-parent
 * @description: TODO
 * @date 2024/11/11  10:42
 */
@RestController
@RequestMapping("/searchservice/search")
@Api(tags = "搜索服务",description = "搜索服务")
public class SearchController {


    @Autowired
    private SearchService searchService;


    /**
     * 分页查询秒杀课程的数据
     *
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/api/listByPage/{currentPage}/{pageSize}")
    public R listByPage(@PathVariable("currentPage") Integer currentPage, @PathVariable("pageSize") Integer pageSize) throws IOException {
     List<Class> classList=searchService.listByPage(currentPage,pageSize);
     return R.ok().data("classList",classList);
    }




}
